#include "chap10.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <signal.h>

int score = 0;

int main() {
	catch_signal(SIGALRM, times_up);
	catch_signal(SIGINT, end_game);
	srandom(time(0));
	while (1) {
		int a = random() % 11;
		int b = random() % 11;
		char txt[4];
		alarm(5);
		printf("\nWhat is %d times %d? ", a, b);
		fgets(txt, 4, stdin);
		int answer = atoi(txt);
		if (answer == a * b) {
			score++;
		} else {
			printf("\nWrong! Score: %i\n", score);
		}
	}
	return 0;
}

